Skip to content

Conversation

@slabko
Copy link
Contributor

@slabko slabko commented Nov 13, 2025

  • Renamed InsertData to SendInsertBlock, to prevent it from appearing first when searching for Insert...
  • Removed EndInsert with a block. Instead, users should now use SendInsertBlock followed by EndInsert.
  • Removed ReceivePreparePackets and replaced it with a call to ReceivePacket, similar to what is done in Insert.
  • Renamed inserting to inserting_ to follow the member variable naming convention.
  • Replaced ProtocolError with ValidationError for the situation when calling other operations is not allowed between BeginInsert and EndInsert
  • Move the BeginInsert body to match the order of the class declaration, placing it between Insert and SendInsertData.

Copy link
Contributor

@theory theory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup, especially the elimination of ReceivePreparePackets, thank you! I've confirmed this commit works with the FDW.


// Send empty block as marker of end of data.
SendData(Block());
inserting = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had it here because I got an error from the bits waiting for a result when I had it where you've now moved it.

Block Client::Impl::BeginInsert(Query query) {
if (inserting) {
if (inserting_) {
throw ProtocolError("cannot execute query while inserting");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to change this one to ValidationError(), too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, my bad, yeah, meant to that too!

Comment on lines 1146 to 1151
// Wait for a data packet and return
uint64_t server_packet = 0;
while (ReceivePacket(&server_packet)) {
if (server_packet == ServerCodes::Data) {
return block;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So much nicer to remove the duplication, thank you!

- Renamed `InsertData` to `SendInsertBlock`, to prevent it from appearing first
  when searching for `Insert...`
- Removed `EndInsert` with a block. Instead, users should now use
  `SendInsertBlock` followed by `EndInsert`.
- Removed `ReceivePreparePackets` and replaced it with a call to
  `ReceivePacket`, similar to what is done in `Insert`.
- Renamed `inserting` to `inserting_` to follow the member variable naming
  convention.
@slabko slabko force-pushed the begin-end-insert-cleanup branch from 9ba3679 to 605a6ba Compare November 13, 2025 20:23
Move the `BeginInsert` body to match the order of the class declaration,
placing it between `Insert` and `SendInsertData`.
@slabko slabko merged commit b8544bb into master Nov 13, 2025
36 checks passed
@slabko slabko deleted the begin-end-insert-cleanup branch November 13, 2025 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants